jq(document).ready(function(){
	var $buyCarShow=jq("#buyCarShow");
	jq.getJSON("BuyCarServlet","action=showCar",function(data){
		var countPay=0;
		for(var i=0;i<data.length;i++){
			$buyCarShow.append("<tr><td><div class=\"c_s_img\"><img src=\"images/c_1.jpg\" width=\"73\" height=\"73\" /></div>"+data[i].name+"</td><td align=\"center\">"+data[i].shuxin+"</td><td align=\"center\"><div class=\"c_num\">"+data[i].number+"</div></td><td align=\"center\" style=\"color:#ff4e00;\">￥"+data[i].totalPay+"</td><td align=\"center\">26R</td>" +
					"</tr>");
			countPay=countPay+data[i].totalPay;
			
		}
		$buyCarShow.append("<tr><td colspan=\"5\" align=\"right\" style=\"font-family:'Microsoft YaHei';\" id=\"spzj\">商品总价：￥"+countPay+" ； 返还积分 "+26*data.length+"R   </td></tr>");
	});
	
	
	//右上角小购物车展示
	var $i_car=jq(".i_car");
	jq.getJSON("BuyCarServlet","action=showCar",function(data){
		var countPay=0;
		$i_car.append("<div class=\"car_t\">购物车 [ <span>"+data.length+"</span> ]</div>");
		$i_car.append("<div class=\"car_bg\"></div>");
		var $car_bg=jq(".car_bg");
		$car_bg.append("<div class=\"un_login\">还未登录！<a href=\"Login.jsp\" style=\"color:#ff4e00;\">马上登录</a> 查看购物车！</div>");
		for(var i=0;i<data.length;i++){
			$car_bg.append("<ul class=\"cars\"><li><div class=\"img\"><a href=\"#\"><img src=\"images/car1.jpg\" width=\"58\" height=\"58\" /></a></div><div class=\"name\"><a href=\"#\">"+data[i].name+"</a></div><div class=\"price\"><font color=\"#ff4e00\">"+data[i].totalPay/data[i].number+"</font> X"+data[i].number+"</div></li></ul>");
			countPay=countPay+data[i].totalPay;
		}
		$car_bg.append("<div class=\"price_sum\">共计&nbsp; <font color=\"#ff4e00\">￥</font><span>"+countPay+"</span></div><div class=\"price_a\"><a href=\"#\">去购物车结算</a></div>");
	});
	
	
	
});